<?php
// +----------------------------------------------------------------------
// | B5LaravelCMF
// +----------------------------------------------------------------------
// | Author: 李恒 <357145480@qq.com>
// +----------------------------------------------------------------------
namespace App\Http\Controllers\Admin\Wall;

use App\Http\Controllers\Admin\Backend;
use App\Services\Wall\WallPrizeService;
use App\Services\Wall\WallPrizeUsersService;
use App\Services\Wall\WallService;
use Illuminate\Http\Request;

class WallPrizeUsersController extends Backend
{
    public function __construct(Request $request)
    {
        parent::__construct($request);
        $this->service = new WallPrizeUsersService();
        $this->view_group = 'wall';
    }

    public function index()
    {
        if(IS_GET){
            $wall_id=intval(request()->input('wall_id',0));
            if($wall_id<1){
                return $this->toError('参数错误');
            }
            $wallInfo=(new WallService())->info($wall_id);
            if(!$wallInfo) return $this->toError('活动信息不存在');
            view()->share('wallInfo',$wallInfo);

            $prizeList=(new WallPrizeService())->getAll([['wall_id','=',$wallInfo['id']]],['id','thumbimg','title','name'],[],'id');
            view()->share('prizeList',$prizeList);
        }
        return parent::index(); // TODO: Change the autogenerated stub
    }



}
